package com.teradyne.merlin2.ui.client.activitymappers;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.teradyne.merlin2.ui.client.activities.ActivityAsyncProxy;
import com.teradyne.merlin2.ui.client.activities.OrderEntryActivity;
import com.teradyne.merlin2.ui.client.activities.OrderListActivity;
import com.teradyne.merlin2.ui.client.activities.QuoteListActivity;
import com.teradyne.merlin2.ui.client.places.OrderEntryPlace;
import com.teradyne.merlin2.ui.client.places.OrderListPlace;
import com.teradyne.merlin2.ui.client.places.QuoteListPlace;

public class CenterActivityMapper implements ActivityMapper {

	private final Provider<ActivityAsyncProxy<OrderListActivity>> orderListActivityProvider;
	private final Provider<ActivityAsyncProxy<OrderEntryActivity>> orderEntryActivityProvider;
	private final Provider<ActivityAsyncProxy<QuoteListActivity>> quoteListActivityProvider;

	@Inject
	public CenterActivityMapper(
			Provider<ActivityAsyncProxy<OrderListActivity>> orderListActivityProvider,
			Provider<ActivityAsyncProxy<OrderEntryActivity>> orderEntryActivityProvider,
			Provider<ActivityAsyncProxy<QuoteListActivity>> quoteListActivityProvider) {
		this.orderListActivityProvider = orderListActivityProvider;
		this.orderEntryActivityProvider = orderEntryActivityProvider;
		this.quoteListActivityProvider = quoteListActivityProvider;
	}

	@Override
	public Activity getActivity(Place place) {
		if (place instanceof OrderListPlace) {
//			OrderListActivity order;
//			order.setId(Id);
//			ActivityAsyncProxy<OrderListActivity> orderList = orderListActivityProvider.get();
			return orderListActivityProvider.get();
		} else if (place instanceof OrderEntryPlace) {
			return orderEntryActivityProvider.get();
		} else if (place instanceof QuoteListPlace) {
			return quoteListActivityProvider.get();
		} else {
			return null;
		}
	}
}